package com.example.boot1.conttoller;

import com.example.boot1.bean.Image;
import com.example.boot1.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;


//局部跨域  注解 @CrossOrigin
@CrossOrigin
@RestController
public class VueUploadController {


    @Autowired
    private UploadService uploadService;


    @PostMapping("/vue/uploads")
    public Object uploadImg(@RequestParam("file") MultipartFile[] multipartFiles){
        List<Image> list =uploadService.upload(multipartFiles);
        return list;
    }
}
